package com.lagou.edu.homework.controller;

import com.lagou.edu.service.EmailDubboService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/email")
@Slf4j
public class EmailController {

    @Reference
    private EmailDubboService emailService;

    /**
     * 发送验证码到邮箱
     *
     * @param email
     * @return
     */
    @GetMapping("/{email}/{code}")
    public Boolean send(@PathVariable String email, @PathVariable String code) {
        return emailService.sendEmail(email, code);
    }

}
